<?php
session_start();
require_once('config.php');
require_once('classes/class.jira.php');
include("classes/connect.php");

// add comment - {tab4}
if(isset($_REQUEST['txtComment']) && $_REQUEST['txtComment']!=''){
    
    $config->host= $host;
    $config->port= "";     
    $config->username = $_SESSION["Juname"];
    $config->password = $_SESSION["Jpass"];
    $queryAddComment = new Jira($config);    

    $commnt_data->body = $_REQUEST['txtComment'];
    $response = $queryAddComment->addComment($_REQUEST['issueid'], $commnt_data); 
    
   if($response->responseBody){
       $sqlquery = "UPDATE trn_emaildetails SET 
                            modifiedBy = '". $_SESSION['jiraUserFullName'] ."',
                            modifiedDate = '". time() ."' 
							where id='".$_REQUEST['id']."'";
    
	mysql_query($sqlquery);
    
       echo json_encode(array('code' => 100));
   }else{
       echo json_encode(array('code' => 500));
   }
    
}
